package com.controller;

import com.Service.impl.userServiceImpl;
import com.Service.userService;
import com.model.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("Login")
public class UserController {
    @Resource
    private userService userService;

    @RequestMapping("Login")
    public String Login(User user, HttpSession session, HttpServletRequest request){
        session.removeAttribute("err");//错误信息消散
           user =userService.Login(user);//user查询

        if(user!=null){


            session.setAttribute("user",user);
//


            return "redirect:/UserPermissions/index";//跳转页面获取
        }else{


            session.setAttribute("err","错误");
            return "index";
        }

    }
}
